package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.MainPostBean;
import com.project.bean.ReplyBean;
import com.project.mapper.IMainPostMapper;
import com.project.service.IMainPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.util.List;

@Service
@Transactional
public class MainPostServiceImpl implements IMainPostService {
    @Autowired
    private IMainPostMapper mainPostMapper;
    @Override
    public IPage<MainPostBean> cutFindByItem(Integer pageNum, Integer channelID,String title,
                                             String userName, LocalDate startDate, LocalDate endDate) {
        return mainPostMapper.cutFindByItem(new Page<>(pageNum,2),channelID,title,userName,startDate,endDate);
    }

    @Override
    public void add(MainPostBean mainPostBean) {
        mainPostMapper.insert(mainPostBean);
    }

    @Override
    public MainPostBean findByID(Integer mainPostID) {
        return mainPostMapper.findByID(mainPostID);
    }
}
